package cn.cool.types.design.framework.tree;

import lombok.Getter;
import lombok.Setter;


/**
 * 在路由功能的基础上，增加多线程数据加载区
 */
public abstract class AbstractMultiThreadStrategyRouter<T, D, R> extends AbstractStrategyRouter<T, D, R> {

    @Override
    public R apply(T requestParameter, D dynamicContext) throws Exception {
        // 异步加载数据
        multiThread(requestParameter, dynamicContext);
        // 业务逻辑受理
        return doApply(requestParameter, dynamicContext);
    }

    /**
     * 异步加载数据
     */
    protected abstract void multiThread(T requestParameter, D dynamicContext) throws Exception;

    /**
     * 业务逻辑受理
     */
    protected abstract R doApply(T requestParameter, D dynamicContext) throws Exception;

}
